package com.loong.common.mvc;

import com.loong.global.dto.UserDTO;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;

public class BaseForeheadController extends BaseController {

    @ModelAttribute("userInfo")
    public UserDTO before(HttpServletRequest request) {
        String paramUserId = request.getParameter("headerUid");
        //TODO 暂时注销
//        if (StringUtils.isEmpty(paramUserId)) {
//            return null;
//        }
      //  Integer uid = Integer.valueOf(paramUserId);
       // UserDTO userDO = RedisTools.valueOperations().get(RedisKey.MEMBER.USER_CACHE + uid, UserDTO.class);
        UserDTO userDTO = new UserDTO();
        userDTO.setId(1L);
        userDTO.setUsername("admin");
        return userDTO;
    }

    public UserDTO getUserDTO(){
        UserDTO userDTO = new UserDTO();
        userDTO.setId(1L);
        userDTO.setUsername("customerA");
        userDTO.setMemberLevelId(1);
        userDTO.setMemberVipLevel(1);
        userDTO.setUserType(1);
        return userDTO;
    }
}
